package com.sxpi.zixun.controller.order;

import com.sxpi.pug.alipay.AliPayProperties;
import com.sxpi.zixun.common.anno.IgnoreToken;
import com.sxpi.zixun.controller.BaseController;
import com.sxpi.zixun.local.UserThreadLocal;
import com.sxpi.zixun.pojo.AdminUser;
import com.sxpi.zixun.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 飞哥
 * @Title: 学相伴出品
 * @Description: 飞哥B站地址：https://space.bilibili.com/490711252
 * 记得关注和三连哦！
 * @Description: 我们有一个学习网站：https://www.kuangstudy.com
 * @date 2022/5/13$ 21:30$
 */
@RestController
@Slf4j
public class OrderController extends BaseController {

    @PostMapping("/order/save")
    public AdminUser markOrder(){
       return UserThreadLocal.get();
    }

    /**
     * 这个接口不需要token的检测
     * @return
     */
    @PostMapping("/order/list")
    @IgnoreToken
    public String findorder(){
        return "success";
    }

    @Autowired
    private AliPayProperties aliPayProperties;

    @GetMapping("/order/info3")
    public Map<String,Object> getYamlInfo3(){
        Map<String,Object> map = new HashMap<>();
        map.put("appid",aliPayProperties.getAppid());
        map.put("notifyUrl",aliPayProperties.getNotifyUrl());
        map.put("key",aliPayProperties.getKey());
        map.put("publieKey",aliPayProperties.getPubliekey());
        return map;
    }

}
